<template>
  <div style="margin: 0; padding: 0;">
    <table class="print-table" style="border-collapse: collapse; width: 100%;">
      <thead>
        <tr>
          <th class="noborder" style="" :colspan="columnFinalData.length">
            {{printTitle}}
          </th>
        </tr>
        <tr>
          <th v-for="(item, index) in columnFinalData" :key="index">
            {{item.label}}
          </th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item, index) in tableData" :key="index">
          <td v-for="(item2, index2) in columnFinalData" :key="index2">
            {{item[item2.name]}}
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
  export default {
    name: 'print-table',
    props: {
      columnFinalData: {
        type: Array,
        default: () => ([])
      },
      tableData: {
        type: Array,
        default: () => ([])
      },
      printTitle:{
        type:String,
        default: ''
      }
    },
    data() {
      return {}
    },
    computed: {},
    created() {},
    methods: {

    }
  }
</script>
<style rel="stylesheet/scss" lang="scss">
  table.print-table {
    border-collapse: collapse;
    border-spacing: 0;
    width: calc(100% - 20px);

    thead th {
      border: 1px solid #000;
      text-align: center;
      border-bottom: 0px;
      padding: 10px 0;
    }

    thead th.noborder {
      font-size: 14pt;
      font-weight: normal;
      border: 0px;
      padding-top: 0;
    }

    tbody td {
      border: 1px solid #000;
      text-align: center;
      word-wrap: break-word;
      max-width: 50px;
    }

    tbody {
      text-align: center;
    }
  }
</style>
